package main

import (
	"fmt"
)

func main() {
	//利用make创建切片
	a := make([]int, 5) // len(a)=5, cap(a)=5
	fmt.Println(cap(a))
	b := make([]int, 0, 5) // len(b)=0, cap(b)=5
	fmt.Println(cap(b))
	b = b[:cap(b)] // len(b)=5, cap(b)=5
	fmt.Println(b)
	// 二维切片
	c := make([][]int, 3) // len(c)=3, cap(c)=3
	for i := 0; i < 3; i++ {
		innerLen := i + 1
		c[i] = make([]int, innerLen) // len(c[i])=i+1, cap(c[i])=i+1
	}
	fmt.Println(c)
	fmt.Println("-----------------")
	//切片的切片')
	board := [][]string{
		[]string{"1", "1", "1"},
		[]string{"1", "1", "1"},
		[]string{"1", "1", "1"},
	}
	fmt.Println(board)
}
